package com.cloudbroker.openapi.manage.controller;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.credits.back.*;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.credits.vo.*;
import com.cloudbroker.bcs.platform.ltb.bizapi.t2service.credits.CreditsT2BizService;
import com.cloudbroker.bcs.platform.ltb.common.ext.annotation.SaveLog;
import com.hundsun.jresplus.remoting.impl.annotation.Service;
import com.hundsun.jresplus.remoting.impl.annotation.ServiceParam;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import static com.cloudbroker.bcs.platform.ltb.common.util.RequestUtil.getSingleParameterMapForBody;


/**
 * Created by lili19289 on 2016/12/7.
 */
@Controller
public class CreditsController {


    @Resource
    private CreditsT2BizService creditsT2BizService;

    /**
     * 个人积分查询
     */
    @ResponseBody
    @RequestMapping(value="/credits_qry",method = RequestMethod.POST)
    @SaveLog(remark = "个人积分查询")
    public CreditsBackVO function_get_user_credits(HttpServletRequest request){
        UserCreditsForm form = getSingleParameterMapForBody(request , UserCreditsForm.class);
        return creditsT2BizService.function_get_user_credits(form);
    }

    /**
     * 个人积分流水查询
     */
    @ResponseBody
    @RequestMapping(value="/credits_log_qry",method = RequestMethod.POST)
    @SaveLog(remark = "个人积分流水查询")
    public CreditsLogListBackVO function_query_creditsLog(HttpServletRequest request){
        QueryCreditslogForm form = getSingleParameterMapForBody(request , QueryCreditslogForm.class);
        return creditsT2BizService.function_query_creditsLog(form);
    }


    /**
     * 个人任务进度查询
     */
    @ResponseBody
    @RequestMapping(value="/task_progress_qry",method = RequestMethod.POST)
    @SaveLog(remark = "个人任务进度查询")
    public TaskProgressListBackVO function_query_task_progress(HttpServletRequest request){
        TaskProgressQueryForm form = getSingleParameterMapForBody(request , TaskProgressQueryForm.class);
        return creditsT2BizService.function_query_task_progress(form);
    }


    @ResponseBody
    @RequestMapping(value="/credits_rule_add",method = RequestMethod.POST)
    @SaveLog(remark = "添加积分规则")
    public ResultVO func_add_credits_rule(HttpServletRequest request){
        CreditsRuleAddForm form = getSingleParameterMapForBody(request , CreditsRuleAddForm.class);
        return creditsT2BizService.func_add_credits_rule(form);
    }

    @ResponseBody
    @RequestMapping(value="/credits_rule_update",method = RequestMethod.POST)
    @SaveLog(remark = "更新积分规则")
    public HSBCPSBackVO func_update_credits_rule(HttpServletRequest request){
        CreditsRuleUpdateform form = getSingleParameterMapForBody(request , CreditsRuleUpdateform.class);
        return creditsT2BizService.func_update_credits_rule(form);
    }

    @ResponseBody
    @RequestMapping(value="/credits_rule_delete",method = RequestMethod.POST)
    @SaveLog(remark = "删除积分规则")
    public HSBCPSBackVO func_delete_credits_rule(HttpServletRequest request){
        CreditsRuleDeleteForm form = getSingleParameterMapForBody(request , CreditsRuleDeleteForm.class);
        return creditsT2BizService.func_delete_credits_rule(form);
    }

    @ResponseBody
    @RequestMapping(value="/credits_rule_qry",method = RequestMethod.POST)
    @SaveLog(remark = "查询积分规则")
    public CreditsRuleListBackVO func_query_credits_rule(HttpServletRequest request){
        QueryCreditsRuleForm form = getSingleParameterMapForBody(request , QueryCreditsRuleForm.class);
        return creditsT2BizService.func_query_credits_rule(form);
    }


    @ResponseBody
    @RequestMapping(value="/credits_task_add",method = RequestMethod.POST)
    @SaveLog(remark = "积分任务添加")
    public ResultVO funct_add_tasck_configure(HttpServletRequest request){
        TaskAddForm form = getSingleParameterMapForBody(request , TaskAddForm.class);
        return creditsT2BizService.funct_add_tasck_configure(form);
    }

    @ResponseBody
    @RequestMapping(value="/credits_task_update",method = RequestMethod.POST)
    @SaveLog(remark = "积分任务更新")
    public HSBCPSBackVO func_update_task_configure(HttpServletRequest request){
        TaskUpdateForm form = getSingleParameterMapForBody(request , TaskUpdateForm.class);
        return creditsT2BizService.func_update_task_configure(form);
    }

    @ResponseBody
    @RequestMapping(value="/credits_task_delete",method = RequestMethod.POST)
    @SaveLog(remark = "积分任务删除")
    public HSBCPSBackVO func_delete_task_configure(HttpServletRequest request){
        TaskDeleteForm form = getSingleParameterMapForBody(request , TaskDeleteForm.class);
        return creditsT2BizService.func_delete_task_configure(form);
    }

    @ResponseBody
    @RequestMapping(value="/credits_task_qry",method = RequestMethod.POST)
    @SaveLog(remark = "积分任务查询")
    public TaskConfigureListBackVO func_query_task_configure(HttpServletRequest request){
        TaskQueryForm form = getSingleParameterMapForBody(request , TaskQueryForm.class);
        return creditsT2BizService.func_query_task_configure(form);
    }

    @ResponseBody
    @RequestMapping(value="/credits_limit_add",method = RequestMethod.POST)
    @SaveLog(remark = "积分上限添加")
    public ResultVO func_add_credlits_limit(HttpServletRequest request){
        CreditsLimitAddForm form = getSingleParameterMapForBody(request , CreditsLimitAddForm.class);
        return creditsT2BizService.func_add_credlits_limit(form);
    }

    @ResponseBody
    @RequestMapping(value="/credits_limit_update",method = RequestMethod.POST)
    @SaveLog(remark = "积分上限更新")
    public HSBCPSBackVO func_update_credlits_limit(HttpServletRequest request){
        CreditsLimitUpdateForm form = getSingleParameterMapForBody(request , CreditsLimitUpdateForm.class);
        return creditsT2BizService.func_update_credlits_limit(form);
    }

    @ResponseBody
    @RequestMapping(value="/credits_limit_delete",method = RequestMethod.POST)
    @SaveLog(remark = "积分上限删除")
    public HSBCPSBackVO func_delete_credlits_limit(HttpServletRequest request){
        CreditsLimitDeleteForm form = getSingleParameterMapForBody(request , CreditsLimitDeleteForm.class);
        return creditsT2BizService.func_delete_credlits_limit(form);
    }

    @ResponseBody
    @RequestMapping(value="/credits_limit_qry",method = RequestMethod.POST)
    @SaveLog(remark = "积分上限查询")
    public CreditsLimitListBackVO func_query_credits_limit(HttpServletRequest request){
        CreditsLimitQueryForm form = getSingleParameterMapForBody(request , CreditsLimitQueryForm.class);
        return creditsT2BizService.func_query_credits_limit(form);
    }


}
